package com.zhongketech.sunflower;


import java.util.ArrayList;
import java.util.List;

import com.zhongketech.sunflower.R;
import com.zhongketech.sunflower.database.ApplicationData;
import com.zhongketech.sunflower.database.Data;
import com.zhongketech.sunflower.database.PhoneNumberData;
import com.zhongketech.sunflower.util.Constants;
import com.zhongketech.sunflower.util.Root;
import com.zhongketech.sunflower.util.SystemUiHider;
import com.zhongketech.sunflower.util.Utilities;
import com.zhongketech.sunflower.view.LogUpdate;
import com.zhongketech.sunflower.view.PhoneNumList;
import com.zhongketech.sunflower.view.UninstallList;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.KeyEvent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;



public class StopAppActivity extends BaseActivity {

	private final static String TAG = "StopAppActivity";

	private MyHandler myHandler = null;



	/**
	 * View init
	 */
	private TextView textView = null;
	private Button button = null;


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.stopapp);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,  WindowManager.LayoutParams.FLAG_FULLSCREEN);  
		getIntent().addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

		//custom
		myHandler = new MyHandler();
		initView();

	}
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		Utilities.logCat(TAG, "onKeyDown: "+keyCode, Constants.LOG_ONLYSHELL);
		if(keyCode == KeyEvent.KEYCODE_BACK)
		{
			return true;
		}
		
		return super.onKeyDown(keyCode, event);
	}

	private void gotoHome()
	{
		List<String> cmdList = new ArrayList<String>();
		cmdList.add("input keyevent 3");
		try {
			Root.doCmds(cmdList);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		Intent mIntent = this.getIntent();  
		textView.setText( mIntent.getStringExtra("packageName"));
	}

	private void initView()
	{
		textView = (TextView) findViewById(R.id.textview);
		button = (Button) findViewById(R.id.button);
		button.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				gotoHome();
				finish();

			}
		});
	}



	/**
	 * 数据 更新操作
	 */
	static class MyHandler extends Handler
	{


		@Override
		public void handleMessage(Message msg) 
		{

			switch (msg.what) {



			default:
				break;
			}
		}

	}
}
